﻿/*
Correction du bug no 3749
*/
update medianamik_Property
set ValidationRegex = '/.*'
where PropertyId = '4BB3FFBA-AC89-4206-8697-BE4CB58190D5' and 
TypeId = '0D9D1AA8-2C70-4402-ABD1-6CC028024967'

IF NOT EXISTS ( 
Select * FROM Information_Schema.COLUMNS
where TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'medianamik_Group'
AND Column_Name = 'ParentGroupId'
)
BEGIN
	ALTER TABLE dbo.medianamik_Group
	ADD   ParentGroupId UNIQUEIDENTIFIER NULL

	ALTER TABLE dbo.medianamik_Group
	ADD   Path VARCHAR(500) NULL

	ALTER TABLE dbo.medianamik_Group
	ADD   Depth int NULL
END

if (not exists(Select null from Localizations 
where ResourceId = 'AllUsers' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('AllUsers'
           ,'Tous les utilisateurs'
           ,'fr-ca'
           ,'Medianamik_SecurityManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'AllUsers' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('AllUsers'
           ,'All users'
           ,'en-ca'
           ,'Medianamik_SecurityManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'Refresh' 
and ResourceSet = 'Medianamik_Global' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('Refresh'
           ,'Rafraîchir'
           ,'fr-ca'
           ,'Medianamik_Global')
end
if (not exists(Select null from Localizations 
where ResourceId = 'Refresh' 
and ResourceSet = 'Medianamik_Global' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('Refresh'
           ,'Refresh'
           ,'en-ca'
           ,'Medianamik_Global')
end

if (not exists(Select null from Localizations 
where ResourceId = 'GroupsColumn' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('GroupsColumn'
           ,'Groupes'
           ,'fr-ca'
           ,'Medianamik_SecurityManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'GroupsColumn' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('GroupsColumn'
           ,'Groups'
           ,'en-ca'
           ,'Medianamik_SecurityManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'GroupsColumn' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('GroupsColumn'
           ,'Groupes'
           ,'fr-ca'
           ,'Medianamik_SecurityManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'GroupsColumn' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('GroupsColumn'
           ,'Groups'
           ,'en-ca'
           ,'Medianamik_SecurityManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'subscriptiondatecolumn' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('subscriptiondatecolumn'
           ,'Date d''inscription'
           ,'fr-ca'
           ,'Medianamik_SecurityManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'subscriptiondatecolumn' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('subscriptiondatecolumn'
           ,'Subscription Date'
           ,'en-ca'
           ,'Medianamik_SecurityManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'usertab' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('usertab'
           ,'Utilisateur'
           ,'fr-ca'
           ,'Medianamik_SecurityManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'usertab' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('usertab'
           ,'User'
           ,'en-ca'
           ,'Medianamik_SecurityManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'groupstab' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('groupstab'
           ,'Groupes'
           ,'fr-ca'
           ,'Medianamik_SecurityManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'groupstab' 
and ResourceSet = 'Medianamik_SecurityManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('groupstab'
           ,'Groups'
           ,'en-ca'
           ,'Medianamik_SecurityManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'Profile' 
and ResourceSet = 'Medianamik_Tabs' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('Profile'
           ,'Profil'
           ,'fr-ca'
           ,'Medianamik_Tabs')
end
if (not exists(Select null from Localizations 
where ResourceId = 'Profile' 
and ResourceSet = 'Medianamik_Tabs' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('Profile'
           ,'Profile'
           ,'en-ca'
           ,'Medianamik_Tabs')
end

if (not exists(Select null from Localizations 
where ResourceId = 'LanguageNeutralCaptionForType' 
and ResourceSet = 'Medianamik_ContentManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('LanguageNeutralCaptionForType'
           ,'Type multi-langues'
           ,'fr-ca'
           ,'Medianamik_ContentManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'LanguageNeutralCaptionForType' 
and ResourceSet = 'Medianamik_ContentManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('LanguageNeutralCaptionForType'
           ,'Multilingual Type'
           ,'en-ca'
           ,'Medianamik_ContentManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'PropNameColTitle' 
and ResourceSet = 'Medianamik_TypeManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('PropNameColTitle'
           ,'Propriété'
           ,'fr-ca'
           ,'Medianamik_TypeManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'PropNameColTitle' 
and ResourceSet = 'Medianamik_TypeManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('PropNameColTitle'
           ,'Property'
           ,'en-ca'
           ,'Medianamik_TypeManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'ProfileBlog' 
and ResourceSet = 'Medianamik_Tabs' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('ProfileBlog'
           ,'Profil blogueur'
           ,'fr-ca'
           ,'Medianamik_Tabs')
end
if (not exists(Select null from Localizations 
where ResourceId = 'ProfileBlog' 
and ResourceSet = 'Medianamik_Tabs' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('ProfileBlog'
           ,'Profile Blogger'
           ,'en-ca'
           ,'Medianamik_Tabs')
end

if (not exists(Select null from Localizations 
where ResourceId = 'NodesOfAType' 
and ResourceSet = 'Medianamik_TypeManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('NodesOfAType'
           ,'Noeuds de ce type'
           ,'fr-ca'
           ,'Medianamik_TypeManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'NodesOfAType' 
and ResourceSet = 'Medianamik_TypeManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('NodesOfAType'
           ,'Nodes of this type'
           ,'en-ca'
           ,'Medianamik_TypeManagement')
end

if (not exists(Select null from Localizations 
where ResourceId = 'TotalNodesOfAType' 
and ResourceSet = 'Medianamik_TypeManagement' 
and LocaleId = 'fr-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('TotalNodesOfAType'
           ,'Tous les noeuds de ce type'
           ,'fr-ca'
           ,'Medianamik_TypeManagement')
end
if (not exists(Select null from Localizations 
where ResourceId = 'TotalNodesOfAType' 
and ResourceSet = 'Medianamik_TypeManagement' 
and LocaleId = 'en-ca'))
begin
	INSERT INTO [Localizations]
           ([ResourceId]
           ,[Value]
           ,[LocaleId]
           ,[ResourceSet])
     VALUES
           ('TotalNodesOfAType'
           ,'All nodes of this type'
           ,'en-ca'
           ,'Medianamik_TypeManagement')
end